# Maintainer: Michael Schubert <mschu.dev at gmail>

pkgname=ironpython
pkgver=2.7.5.378.ga94945543
pkgrel=4
pkgdesc='Python implementation for the .NET framework.'
arch=("any")
url='http://ironpython.net'
license=('Apache')
depends=('mono')
makedepends=('git')
options=('!strip' 'emptydirs' 'libtool')
source=("$pkgname::git://github.com/IronLanguages/main.git"
        'site.patch')
sha512sums=('SKIP'
            '66f304dc0a2b24c8358b79ec7dd812e23732c415eee071d7402f474b6ec5e230bb72bae7e1645cdaf96fe24ce1b63fa11d8c02888cd4bc4fd5d0ef2e685abe83')

pkgver() {
  cd $pkgname

  git describe --always | sed 's|-|.|g;s|^ipy\.||'
}

build() {
  cd $pkgname

  sed -i "/NoWarn/s|444;||" Solutions/Common.proj

  xbuild Solutions/IronPython.sln /p:Mono=true /p:Configuration="Release"
}

package() {
  install -dm 755 "$pkgdir/opt/ipy" "$pkgdir/usr/bin"

  cp -r "$srcdir/$pkgname/bin/Release/"* "$pkgdir/opt/ipy"

  for bin in ipy ipy64 ipyw ipyw64 ; do
    echo -e "#!/bin/sh\nmono /opt/ipy/$bin.exe $*" > "$pkgdir/usr/bin/$bin"
    chmod +x "$pkgdir/usr/bin/$bin"
  done

  cd "$pkgdir/opt/ipy/Lib"

  patch -p0 < "$srcdir/site.patch"
}

